<?php
	// ----------------------------------------------------
	// Beschreibung Skript:
	//   Gibt den aktuellen Benutzer aus und speichert 
	//   Änderungen an diesem Benutzer.
	//
	// ----------------------------------------------------
	// Änderungen:
	//
	// ----------------------------------------------------

	
	// ------------------------------------------------------
	// Initialisiert das Skript.
	// ------------------------------------------------------  
	require_once 'loader.php';

	// ------------------------------------------------------
	// Verarbeitet POST Daten.
	// ------------------------------------------------------  
	if(isset($_POST['ExternalUserID'])) {
		$ExterUserID = htmlspecialchars($_POST['ExternalUserID']);
	}
	$Member->getUserData($ExterUserID);

	// ------------------------------------------------------
	// Header laden.
	// ------------------------------------------------------
	$Header->printHeader();
		
	// ------------------------------------------------------
	// Benutzerdaten laden.
	// ------------------------------------------------------  
	// Print personal data.
	$birthday = new DateTime($Member->Birthday);
	$arrLabel = Array('Name', 'Geb', 'Adresse', 'PLZ', 'Ort', 'Tel-P', 'Tel-G', 'Mobile', 'E-Mail-P', 'E-Mail-G', 'Webseite-P', 'Webseite-G');
	$arrValue = Array($Member->LastName, $birthday->format('d.m.Y'), 
			$Member->Address->Address, $Member->Address->PLZ, $Member->Address->City,
			$Member->Contact->TelefonPrivate, $Member->Contact->TelefonBusiness, $Member->Contact->TelefonMobile,
			$Member->Contact->EmailPrivate, $Member->Contact->EmailBusiness,
			$Member->Contact->WebsitePrivate, $Member->Contact->WebsiteBusiness);
	//
	print('<form Action="set_actiondata.php" method="post">'."\n");
	print('<input type="hidden" name="ExternalUserID" value="'.$ExterUserID.'">'."\n");
	print('<input type="hidden" name="Action" value="setUser">'."\n");
	print('<table>'."\n");
	print('  <tbody>'."\n");
	print('    <tr>'."\n");
	print('      <td valign="top" rowspan="'.(count($arrLabel)+1).'" width="120">'."\n");
	print('        <img src="'.$Member->ImagePath.'" alt="'.$Member->UserName.'" width="'.strval($Member->ImageWidth).'" height="'.strval($Member->ImageHeigth).'"><br />'."\n");
	print('      </td>'."\n");
	print('      <td width="150">Vorname:</td>'."\n");
	print('      <td><input name="Vorname" type="text" size="30" maxlength="30" value="'.$Member->FirstName.'" /></td>'."\n");
	print('    </tr>'."\n");
	For ($ix = 0; $ix < count($arrLabel); $ix++) {
		print('    <tr>'."\n");
		print('      <td>'.$arrLabel[$ix].':</td>'."\n");
		print('      <td><input name="'.$arrLabel[$ix].'" type="text" size="30" maxlength="30" value="'.$arrValue[$ix].'" /></td>'."\n");
		print('    </tr>'."\n");
	}
	print('    <tr>'."\n");
	print('      <td>&nbsp;</td><td>&nbsp;</td><td align="right">'."\n");
	print('      	<input type="button" value="Abbrechen" onclick="location.href = \'get_user.php\'">'."\n");
	print('      	<span style="width:10pt;">&nbsp;</span>'."\n");
	print('      	<input type="submit" value="Senden">'."\n");
	print('      </td>'."\n");
	print('    </tr>'."\n");
	print('  </tbody>'."\n");
	print('</table>'."\n");
	print('</form>'."\n");
	print("<br />"."\n");

	// ------------------------------------------------------
	// Footer laden.
	// ------------------------------------------------------
	include 'footer.php';
?>